jQuery(function(h){h.fn.progressScroll=function(e){var r,n,t,i=h.extend({borderSize:10,mainBgColor:"#E6F4F7",lightBorderColor:"#A2ECFB",darkBorderColor:"#39B4CC"},e),d=e[0],a=e[1],o=this,s=this.selector,g="bdt-reading-progress-border",c="bdt-reading-progress-circle",l="bdt-reading-progress-text";this.getHeight=function(){r=window.innerHeight,n=document.body.offsetHeight,t=n-r},this.addEvent=function(){var e=document.createEvent("Event");e.initEvent("scroll",!1,!1),window.dispatchEvent(e)},this.updateProgress=function(e){var r=Math.round(100*e),n=360*r/100;n<=180?h("."+g,s).css("background-image","linear-gradient("+(90+n)+"deg, transparent 50%, "+d+" 50%),linear-gradient(90deg, "+d+" 50%, transparent 50%)"):h("."+g,s).css("background-image","linear-gradient("+(n-90)+"deg, transparent 50%, "+a+" 50%),linear-gradient(90deg, "+d+" 50%, transparent 50%)"),h("."+l,s).text(r+"%")},this.prepare=function(){h(s).html("
"),h("."+g,s).css({"background-color":a,"background-image":"linear-gradient(91deg, transparent 50%,"+i.lightBorderColor+"50%), linear-gradient(90deg,"+i.lightBorderColor+"50%, transparent 50%"}),h("."+c,s).css({width:i.width-i.borderSize,height:i.height-i.borderSize})},this.init=function(){o.prepare(),h(window).bind("scroll",function(){var e=window.pageYOffset||document.documentElement.scrollTop,r=Math.max(0,Math.min(1,e/t));o.updateProgress(r)}),h(window).bind("resize",function(){o.getHeight(),o.addEvent()}),h(window).bind("load",function(){o.getHeight(),o.addEvent()})},o.init()}});